﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace FxCopContrib.TestHarness
{
    internal static class StackTraceExtensions
    {
        public static IEnumerable<StackFrame> ToEnumerable(this StackTrace stackTrace)
        {
            int currentIndex = stackTrace.FrameCount - 1;

            for (; currentIndex >= 0; currentIndex--)
            {
                yield return stackTrace.GetFrame(currentIndex);
            }
        }
    }
}
